package com.sg.controller.bff;

import com.sg.service.biz.bff.CaptchaService;
import com.sg.dto.biz.bff.req.BffCheckCaptchaValidComReqDto;
import com.sg.dto.biz.bff.req.BffQueryGetCaptchaDetailReqDto;
import com.sg.dto.biz.bff.res.BffCheckCaptchaValidComRespDto;
import com.sg.dto.biz.bff.res.BffQueryGetCaptchaDetailRespDto;
import com.sg.common.ro.OkrResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ：
 * @version 1.0
 * @date ：
 */
@Api(value = "Captcha", tags = {"Captcha"})
@RestController
// @RequestMapping("/oms/captcha/")
public class CaptchaController {

    @Autowired
    CaptchaService captchaService;

    /**
     * B1-发送验证码（公共）
     * gen by moon at 8/10/2022, 3:33:26 AM
     */
    @PostMapping("/oms/captcha/queryGetCaptchaDetail")
    @ApiOperation(value = "B1-发送验证码（公共）", response = OkrResult.class)
    public OkrResult<BffQueryGetCaptchaDetailRespDto> queryGetCaptchaDetail(@RequestBody(required = false) @Validated BffQueryGetCaptchaDetailReqDto reqDTO) {
        return OkrResult.success(captchaService.queryGetCaptchaDetail(reqDTO));
    }

    /**
     * B1-检查验证码是否有效(公共)
     * gen by moon at 8/10/2022, 3:38:41 AM
     */
    @PostMapping("/oms/captcha/checkCaptchaValidCom")
    @ApiOperation(value = "B1-检查验证码是否有效(公共)", response = OkrResult.class)
    public OkrResult<BffCheckCaptchaValidComRespDto> checkCaptchaValidCom(@RequestBody(required = false) @Validated BffCheckCaptchaValidComReqDto reqDTO) {
        return OkrResult.success(captchaService.checkCaptchaValidCom(reqDTO));
    }
}
